home *** CD-ROM | disk | FTP | other *** search
/ Windows News 2006 October / wn148cd2.iso / Windows / Travailler / QuickZip / quickzip_460013.exe / {app} / Scripts / Relative.akp < prev    next >
Text File  |  2002-12-17  |  2KB  |  56 lines

  1. //Ratively backup All Files/Subdir in Directory <Directory2Backup>
  2. //to <ZipDirectory>
  3. const Directory2Backup = 'c:\Qzip3\';
  4.       ZipDirectory = 'c:\temp\Qzip3';
  5. var RootDrive : String;
  6. procedure RelativeBackup;
  7. var ParamList,NewFileList : TStringList;
  8.     ZipList : TStringList;
  9.     i,j,k : integer;
  10.     Backup,ZipDir : String;
  11.     fn : string;
  12. begin
  13. Backup := Appendslash(Directory2Backup);
  14. ZipDir := AppendSlash(ZipDirectory);
  15. ParamList := TStringList.create;
  16. ZipList := TStringList.create;
  17. ZipList.Sorted := True;
  18. NewFileList := TStringList.create;
  19. NewFilelist.sorted := true;
  20.  
  21. ParamList.AddStrings(Pollfilelist(Backup+'*.*',True));
  22. ZipList.AddStrings(Pollfilelist(ZipDir+'Backup*.Zip',False));
  23. NewFileList.AddStrings(ParamList);
  24.  
  25. for i := 0 to ZipList.count -1 do
  26.  begin
  27.    open(ZipList.strings[i]);
  28.     for j := 0 to total_Contents -1 do
  29.      begin
  30.       fn := RootDrive+Contents_FileDefpath(j)+Contents_Filename(j);
  31.       if Contents_Filename(j) = ExtractFilename(fn) then
  32.       if Contents_FileSize(j) = getfilesize(fn) then
  33.       if GetFileDatetime(ZipList.strings[i]) > GetFileDatetime(fn) then
  34.            if NewFileList.Find(fn,k) then
  35.             NewFileList.Delete(k);
  36.      end;
  37.  end;
  38.  
  39. i := 0;
  40. While FileExists(ZipDir+'Backup'+inttoStr(i)+'.zip') do
  41.   i := i + 1;
  42.  
  43. UseAddPath(True);
  44. Open(ZipDir+'Backup'+inttoStr(i)+'.zip');
  45. For i := 0 to NewFileList.count -1 do
  46.   Add(NewFileList.Strings[i]);
  47. if NewFilelist.count > 0 then
  48. DoAdd;
  49. end;
  50.  
  51. begin
  52.   RootDrive := Copy(ZipDirectory,1,3);
  53.   RelativeBackup;
  54.   Writeln('Completed!');
  55. end.
  56.